Skip to content

fix: scale mermaid diagrams to fit container width#386

Open
max-digi wants to merge 1 commit intomainfrom
fix/mermaid-diagram-scaling
Open

fix: scale mermaid diagrams to fit container width#386
max-digi wants to merge 1 commit intomainfrom
fix/mermaid-diagram-scaling

Conversation

@max-digi
Copy link
Copy Markdown
Contributor

@max-digi max-digi commented May 6, 2026

Summary

  • Mermaid renders SVGs with explicit width/height HTML attributes that override CSS max-width, causing diagrams to render at full native size (huge and illegible)
  • Fix: remove those attributes after render and set width: 100% via style so the SVG scales to its container
  • Applies to both StaticMermaidDiagram and MermaidDiagram components

Affected pages

  • guide/node/validator-status (state diagram — the reported issue)
  • protocol/zones/architecture (2 flowcharts)
  • protocol/zones/proving (flowchart)
  • accounts/ (sequence diagram)
  • guide/machine-payments/* and payments/virtual-addresses (sequence diagrams via MermaidDiagram)

Test plan

  • Check guide/node/validator-status — state diagram should be compact, not full-screen tall
  • Spot-check one or two other diagram pages above

🤖 Generated with Claude Code

Mermaid renders SVGs with explicit width/height attributes that override
CSS max-width. Remove those attributes and set width: 100% so diagrams
scale to their container instead of rendering at full native size.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tempo-docs Ready Ready Preview, Comment May 6, 2026 10:50am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants